# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=openbao
pkgver=2.0.2
_pkgver=${pkgver/_/-}
pkgrel=0
pkgdesc="solution to manage, store, and distribute sensitive data including secrets, certificates, and keys"
url="https://openbao.org/"
# loongarch64: github.com/shirou/gopsutil/v3@v3.22.6/host/host_linux.go:98:22: undefined: sizeOfUtmp
arch="all !loongarch64"
license="MPL-2.0"
makedepends="go bash"
options="!check net" # many tests require docker
source="https://github.com/openbao/openbao/archive/v$_pkgver/openbao-$_pkgver.tar.gz
	make-bin-without-ui.patch
	build-do-not-assume-git-repo.patch
	build-do-not-install.patch
	"

prepare() {
	default_prepare

	echo "$_pkgver" >version/VERSION
}

build() {
	OPENBAO_VERSION=$pkgver CGO_ENABLED=1 make bin
}

check() {
	make test
}

package() {
	install -Dm0755 -t "$pkgdir/usr/bin/" bin/bao
}

sha512sums="
3bc40950a8e7aecf06a9e95e9d48a54ef771784bf9a8a249b00724c179db7724759dcd6a5ddab1dfac74e784a7dd9b8dec63a7d3a492161d8c20ee0fbad68836  openbao-2.0.2.tar.gz
367c1f063d66dfa1937d7363975bbb6b2f2fafc2f38ce4ba1a1ee0e153443dc99b4e9ad2a944083a186d34bbe494d2c522c92f44ba09ad63dc56b66e42686b02  make-bin-without-ui.patch
7805e6bf9d88cd2321832151ec1e985ecf5a1350176fd18ef1032398ffbf8ff2f0a73b9ba44e41b15e3e8bdc825679463c8ef04ae04f9096f459fcda6f44a11c  build-do-not-assume-git-repo.patch
4277f815de3b9d2e54489a10fec06416d8f2802c0cc702d4a81dae3ab41b23bd8387981536925765450077bffdb05a43f10e4516a89e28c9a2899d480a9fe8f9  build-do-not-install.patch
"
